<template>
  <div>
    <el-table   :data="pictureList" border v-loading="loading" >
      <el-table-column prop="imageViewId" label="图片场景ID"   align="center"></el-table-column>
      <el-table-column prop="imageViewName" label="图片场景名称"   align="center"></el-table-column>
      <el-table-column label="操作" align="center" width="150">
        <template slot-scope="scope">
          <el-button @click="handleEdit(scope.row.imageViewId)"  size="small"  type="primary">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="footer">
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="params.pageIndex"
        :page-sizes="[5, 10, 20, 40]"
        :page-size="params.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pageTotal">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        loading: true,
        imgUrl:imageUrl,
        pictureList:[],
        params:{
          pageSize:5,
          pageIndex:1
        },
        pageTotal:0
      }
    },
    created(){
      // this.getData();
    },
    methods:{ 
      getData(){
        this.loading = true;
        this.$axios.get(this.$api.getImageViewList,{params: this.params})
          .then((res)=>{
            this.pictureList = res.data.result;
            this.loading = false;
          })
        this.$axios.get(this.$api.getImageViewNum,{params: this.params})
          .then((res)=>{
            this.pageTotal = res.data.result.total
          })
      },
      clearSearch(){
        this.params.pageIndex = 1;
        this.getData();
      },
      searchForm(){
        this.params.pageIndex = 1;
        this.getData();
      },
      handleSizeChange(val) {
        this.params.pageSize = val;
        this.getData();
      },
      handleCurrentChange(val) {
        this.params.pageIndex = val;
        this.getData();
      },
      handleEdit(cooperationId) {
        this.$router.push("/picture/pictureForm/"+ cooperationId)
      }


    },
    activated() {
      this.getData();
    },

  };
</script>
